package com.chezhujie.www.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chezhujie.www.domain.Czjcarela;
import com.chezhujie.www.persistence.CzjcarelaMapper;

/**
 * Created by 汤伟杰 on 2017/6/2.
 */
@Service
public class CzjcarelaService extends BaseService{
    @Autowired
    private CzjcarelaMapper czjcarelaMapper;

	public List<Czjcarela> getCzjcarelaList(Map<String, Object> map) {
		return czjcarelaMapper.getCzjcarelaList(map);
	}

	public void deleteByList(List<Czjcarela> list) {
		
		Map<String, Object> map =null;

		for(int i=0;i<list.size();i++){
			if(StringUtils.isNotBlank(list.get(i).getCarela())){
				
				map =new HashMap<String, Object>();
				
				map.put("carela", list.get(i).getCarela());
				czjcarelaMapper.deleteCzjcarela(map);
			}
		}
	}

	public void saveCareList(List<Czjcarela> savelist) {
		czjcarelaMapper.saveCareList(savelist);
		
	}

    public List<Map<String, Object>> queryCommodityIdPriceBy(List<String> strings) {
		if(strings!=null&&strings.size()>0){
			return czjcarelaMapper.queryCommodityIdPriceBy(strings);
		}else{
			return new ArrayList<Map<String, Object>>();
		}

    }
}
